//
//  JCBillTableViewCell.m
//  JiFengDaRen
//
//  Created by shouhan on 2018/5/18.
//  Copyright © 2018年 陈永发. All rights reserved.
//

#import "JCBillTableViewCell.h"

@interface JCBillTableViewCell()

@property (nonatomic, strong) UILabel * withholdLabel;// 代扣金额

@property (nonatomic, strong) UILabel * amount;// 金额（代扣）

@property (nonatomic, strong) UILabel * timeLabel;// 时间

@end

@implementation JCBillTableViewCell

+ (instancetype)tableViewCellWithTableView:(UITableView *)tableView{
    
    static NSString * cellIndentfile = @"JCBillTableViewCell";
    JCBillTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIndentfile];
    
    if (!cell) {
        cell = [[JCBillTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIndentfile];
    }    
    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initUI];
    }
    return self;
}

- (void)initUI{    
    self.withholdLabel = [UILabel new];
    self.withholdLabel.textColor = [UIColor colorWithHexString:@"#333333"];
    self.withholdLabel.font = KSHSystemFont(14);
    self.withholdLabel.text = @"代扣金额:";
    [self.contentView addSubview:self.withholdLabel];
    
    self.amount = [UILabel new];
    self.amount.textColor = [UIColor colorWithHexString:@"#333333"];
    self.amount.font = KSHSystemFont(14);
    [self.contentView addSubview:self.amount];
    
    self.timeLabel = [UILabel new];
    self.timeLabel.textColor = [UIColor colorWithHexString:@"#333333"];
    self.timeLabel.font = KSHSystemFont(14);
    self.timeLabel.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:self.timeLabel];
    
    
}

- (void)layoutSubviews{
    [super layoutSubviews];
    
    [self.withholdLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(__I6Width(15));
        make.centerY.equalTo(self.contentView);
    }];
    
    [self.amount mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.withholdLabel.mas_right).offset(2);
        make.centerY.equalTo(self.contentView);
    }];
    
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView).offset(-__I6Width(15));
        make.centerY.equalTo(self.contentView);
    }];
}

- (void)getAmount:(NSString *)strAmount andDate:(NSString *)strDate{
    
    self.amount.text = [NSString stringWithFormat:@"%@元",strAmount];
    self.timeLabel.text = [NSString stringWithFormat:@"%@",strDate];

}


@end
